﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Portal_Tech
{
    [Serializable()]
    public class SubGroup
    {
        private static int uniqueID = 1;
        private int groupID;
        public int frontMiddleBack;
        public int GroupID
        {
            get
            {
                return groupID;
            }
        
        }
        public int numberInGroup;
        public int NumberInGroup
        {
            get
            {
                return numberInGroup;
            }

        }
        private int floatPlacement;
        public int FloatPlacement
        {
            get
            {
                return floatPlacement;
            }
            private set
            {
                floatPlacement = value;
            }
        }
        public SubGroup()
        { }
        public SubGroup(int noInGroup)
        {
            groupID = uniqueID;
            numberInGroup = noInGroup;
            uniqueID++;
        }
        
        public bool AddMembers(int noToAdd)
        {
            int result = this.numberInGroup + noToAdd;
            if (result < 8)
                return false;
            else if (result > 20)
                return false;
            else
                this.numberInGroup = result;
            return true;
        }
        public bool combineSubgroups(SubGroup receivingGroup)
        {
            return receivingGroup.AddMembers(this.numberInGroup);
        }
        public void SetFrontMiddleBack(int position)
        {
            frontMiddleBack = position;
        }
    }
}
